package com.jysz.certificate.persistence.enums;

import com.jysz.webcore.ssh.web.convert.IEnum;


/**
 * 绩效分配状态
 * 
 * @author <a href="mailto:javaengine@outlook.com">Kaca Rich</a>
 *
 */
public enum PerformanceAssignStatus implements IEnum{
	   
	NOTSTART("暂存", 0), NOT_CONFIRM("待确认", 1), CONFIRM("已确认", 2), ASSIGN("已分配", 3), PM_CONFIRM("财务已确认", 4), PAYMENT("已核发", 10)	; 
   
    //名称
    private String name;
    //索引
    private int index;   
    private PerformanceAssignStatus(String name, int index) {   
        this.name = name;   
        this.index = index;   
    }   
    
    //根据索引获得名称
    public static String getName(int index) {   
        for (PerformanceAssignStatus w : PerformanceAssignStatus.values()) {   
            if (w.getIndex() == index) {   
                return w.name;   
            }   
        }   
        return null;   
    }
    
    //根据索引获得枚举
    public static PerformanceAssignStatus index(int index) {   
    	for (PerformanceAssignStatus w : PerformanceAssignStatus.values()) {   
    		if (w.getIndex() == index) {   
    			return w;   
    		}   
    	}   
    	return null;   
    }
    //根据名字获得枚举
    public static PerformanceAssignStatus indexName(String name) {   
    	for (PerformanceAssignStatus w : PerformanceAssignStatus.values()) {   
    		if (w.getName().equals(name)) {   
    			return w;   
    		}   
    	}   
    	return null;   
    }
    
    public String getName() {   
        return name;   
    }   
    public void setName(String name) {   
        this.name = name;   
    }   
    public Integer getIndex() {   
        return index;   
    }   
    public void setIndex(int index) {   
        this.index = index;   
    }   

	@Override
	public String toString() {
		return this.getName();
	}
}
